package com.atguigu.ssyx.activity.client;

import com.atguigu.ssyx.model.activity.CouponInfo;
import com.atguigu.ssyx.model.order.CartInfo;
import com.atguigu.ssyx.vo.order.CartInfoVo;
import com.atguigu.ssyx.vo.order.OrderConfirmVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * ClassName: ActivityFeignClient
 * Package: com.atguigu.ssyx.activity.client
 * Description:
 *
 * @Author: 比特张
 * @Create: 2023/7/24 - 20:15
 * @Version: v1.0
 */
@FeignClient("service-activity")
public interface ActivityFeignClient {

    @ApiOperation(value = "根据skuId列表获取促销信息")
    @PostMapping("api/activity/inner/findActivity")
    Map<Long, List<String>> findActivity(@RequestBody List<Long> skuIdList);

    @ApiOperation(value = "根据skuId列表获营销数据和优惠卷")
    @GetMapping("api/activity/inner/findActivityAndCoupon/{skuId}/{userId}")
    Map<String, Object> findActivityAndCoupon(@PathVariable Long skuId, @PathVariable Long userId);

    @ApiOperation("获取购物车中满足条件优惠卷和活动的信息")
    @PostMapping("api/activity/inner/findCartActivityAndCoupon/{userId}")
    OrderConfirmVo findCartActivityAndCoupon(@RequestBody List<CartInfo> cartInfoList, @PathVariable Long userId);

    @ApiOperation(value = "获取购物项对应规则数据")
    @PostMapping("api/activity/inner/findCartActivityList")
    List<CartInfoVo> findCartActivityList(@RequestBody List<CartInfo> cartInfoList);

    @ApiOperation("获取购物车对应优惠卷")
    @PostMapping("api/activity/inner/findRangeSkuIdList/{couponId}")
    CouponInfo findRangeSkuIdList(@RequestBody List<CartInfo> cartInfoList, @PathVariable Long couponId);

    @ApiOperation("更新优惠卷使用状态")
    @GetMapping("/api/activity/inner/updateCouponInfoUseStatus/{couponId}/{userId}/{orderId}")
    Boolean updateCouponInfoUseStatus(@PathVariable("couponId") Long couponId,
                                             @PathVariable("userId") Long userId,
                                             @PathVariable("orderId") Long orderId);
}
